package action.country;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.dao.CountryModel;
import model.dto.Country;
import controller.Action;
import controller.ActionForward;

public class ActionGetCountry implements Action{

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		Country dto=null;
		CountryModel dao=new CountryModel();
		int country_id=Integer.parseInt(request.getParameter("id"));
		int page=Integer.parseInt(request.getParameter("page"));
		
		System.out.println("page="+page+"  id="+country_id);
		dto=dao.get(country_id);
		request.setAttribute("dto", dto);
		request.setAttribute("page", page);
		
		ActionForward forward=new ActionForward();
		forward.setPath("add-country.sp");
		forward.setRedirect(false);
		return forward;
	}
}
